home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9248 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.7 KB  |  56 lines

  1. Path: bignews.shef.ac.uk!usenet
  2. From: E.V.Smith@shef.ac.uk (Ez)
  3. Newsgroups: comp.lang.c++
  4. Subject: Help, holding HEX values in struct
  5. Date: 29 Feb 1996 15:40:59 GMT
  6. Organization: Automatic Control & Systems Engineering, University of Sheffield , UK
  7. Message-ID: <4h4heb$a4b@bignews.shef.ac.uk>
  8. NNTP-Posting-Host: pc022085.shef.ac.uk
  9. X-Newsreader: WinVN 0.92.1
  10.  
  11. I am wanting to hold information in a structure.
  12. One piece of info is a pair of hex address for use with 'inport' commands.
  13. My question is, what is the best type to define these as to hold them.
  14. In one case I defined it and it caused all info on the line after the HEX
  15. to be totally ignored on initialising the struct.
  16.  
  17. So what does inport want? is it a type INT or Char or another.
  18.  
  19. The struct I'm playing with should be below.  
  20.  
  21. thanks for any help.
  22. replies via email appreciated.
  23. Eric..
  24.  
  25.  
  26. struct ports
  27. {
  28.  char name[8];
  29.  char port_adr[5];               /// what is the correct way!
  30.  char byte_adr[5];               /// ^^^^^^^^^^^^^^^^^^^^^^^^
  31.  int  port_state;                
  32.  int  shift_fact;
  33.  int  Xpos;
  34.  int  Ypos;
  35. };
  36.  
  37. ports info[]=
  38.         {
  39.          {"sensor1","0x00","0x00",0,1,109,119},
  40.          {"sensor2","0x00","0x00",0,1,109,179},
  41.          {"sensor3","0x00","0x00",0,1,109,239},
  42.          {"sensor4","0x00","0x00",0,1,109,299},
  43.          {"sensor5","0x00","0x00",0,1,109,359},
  44.  
  45.          {"Lpush1Re","0x00","0x00",0,1,400,280},
  46.          {"Lpush1Ex","0x00","0x00",0,1,455,280},
  47.          {"Lpush2Re","0x00","0x00",0,1,400,320},
  48.          {"Lpush2Ex","0x00","0x00",0,1,455,320},
  49.  
  50.          {"Lpull1Re","0x00","0x00",0,1,400,360},
  51.          {"Lpull1Ex","0x00","0x00",0,1,455,360},
  52.          {"Lpull2Re","0x00","0x00",0,1,400,400},
  53.          {"Lpull2Ex","0x00","0x00",0,1,455,400}
  54.         };
  55.  
  56.